//
//  CountryCollectionViewCell.m
//  PTravel
//
//  Created by dllo on 15/11/17.
//  Copyright © 2015年 李涵. All rights reserved.
//

#import "CountryCollectionViewCell.h"



@implementation CountryCollectionViewCell



- (void)dealloc
{
    [_cnname release];
    [_enname release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    
    self.cnname = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, (BOUNDS.size.width-15)/2-45, 20)];
    self.cnname.textColor = [UIColor blackColor];
    self.cnname.font = [UIFont systemFontOfSize:18];
    [self.contentView addSubview:self.cnname];
    [_cnname release];
    
    self.enname = [[UILabel alloc] initWithFrame:CGRectMake(5, self.enname.frame.origin.y+20, (BOUNDS.size.width-15)/2-45, 30)];
    self.enname.font = [UIFont systemFontOfSize:14];
    self.enname.textAlignment = 0;
    [self.contentView addSubview:self.enname];
    [_enname release];
    
}

- (void)setCountry:(Country *)country
{
    if (_country != country) {
        [_country release];
        _country = [country retain];
    }
    
    self.cnname.text = country.cnname;
    self.enname.text = country.enname;
    self.cnname.numberOfLines = 0;
    self.enname.numberOfLines = 0;
    self.enname.lineBreakMode = NSLineBreakByCharWrapping;
    self.enname.textColor = TEXTCOLOR;
    self.cnname.textColor = TEXTCOLOR;
}

@end
